-
Notifications
You must be signed in to change notification settings - Fork 674
Deprecate PaymentSheet Constructors and FlowController.create() #10833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate PaymentSheet Constructors and FlowController.create() #10833
Conversation
Diffuse output:
APK
|
bd65c58
to
7eb9c95
Compare
@@ -22,6 +22,7 @@ import java.util.UUID | |||
* @param paymentResultCallback Called with the result of the payment after [PaymentSheet] is dismissed. | |||
*/ | |||
@Composable | |||
@Deprecated(message = "This will be removed in a future release. Use PaymentSheet.Builder instead.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these use the replace with as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we have two options:
- add
replaceWith
expression withremember (key1, ...) { SomeBuilder() }
. This would be identical with our deprecatedrememberXXX()
, but feels like a bit verbose - add
replaceWith
expression withremember { SomeBuilder() }
. This is okay because callbacks basically do not change.
I lean more toward 1. because it avoids breaking implementation accidentally.
paymentsheet/src/main/java/com/stripe/android/paymentsheet/FlowControllerCompose.kt
Outdated
Show resolved
Hide resolved
7eb9c95
to
ed5a5e8
Compare
CHANGELOG.md
Outdated
@@ -9,6 +9,7 @@ | |||
|
|||
### PaymentSheet | |||
* [ADDED][10919](https://github.com/stripe/stripe-android/pull/10919) Add `formInsetValues` to `PaymentSheet.Appearance`. | |||
* [DEPRECATED][10833](https://github.com/stripe/stripe-android/pull/10833) Deprecated PaymentSheet/FlowController constructors, create methods, and Compose remember functions in favor of new Builder pattern APIs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is under the wrong release!
Co-authored-by: Jay Newstrom <[email protected]>
@Deprecated( | ||
message = "This will be removed in a future release.", | ||
replaceWith = ReplaceWith( | ||
"Builder(callback)" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these need a prefix? If not, why not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean paymentResultCallback
? No, we don't need that because the original constructor is
constructor(
activity: ComponentActivity,
externalPaymentMethodConfirmHandler: ExternalPaymentMethodConfirmHandler,
callback: PaymentSheetResultCallback,
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was referring to the Builder
call. I thought it would need to be PaymentSheet.Builder
or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If using Android Studio to execute the replaceWith
action, the IDE will add the import itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add the prefix in case the users are using more than one Builder, eg. AlertDialog.Builder
, etc.
Summary
PaymentSheet
constructorsPaymentSheet.FlowController.create()
rememberPaymentSheet
andrememberPaymentSheetFlowController
MIGRATING.md
Motivation
We have several new features, e.g.
AnalyticCallback
,confirmCustomPaymentMethodCallback
, that can only be set to aPaymentSheet
/FlowController
by our new Builder pattern. While the old constructor and factory pattern are still in support for backward compatibility, new features would not be added to this legacy initialization. We are deprecating the old constructors to avoid confusion and point the merchants to our new APIs with migration guide.Testing
Changelog
[DEPRECATED]10833 Deprecated PaymentSheet/FlowController constructors, create methods, and Compose remember functions in favor of new Builder pattern APIs.